package com.manage.competition.service.impl;

import com.manage.competition.service.IEmailValidateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * Create with IDEA
 *
 * @Author: gitee.com/KamisamaXX
 * @Date: Create in 15:26 2019/4/8
 * @Description:
 */
@Service
public class EmailValidateServiceImpl implements IEmailValidateService {
    static final private String MAILFORM = "953181215@qq.com";

    @Autowired
    private JavaMailSender mailSender;

    @Override
    public void sendSimpleMail(String mailTo,String Code) throws MailException {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(MAILFORM);
        message.setTo(mailTo);
//        message.setTo("13192269125@163.com");
        message.setSubject("主题：验证码邮件");
        message.setText("验证码: "+Code);

        mailSender.send(message);
    }
}
